﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace Utilities
{
    public class Config
    {
        private readonly Configuration _config;

        public ConnectionStringSettingsCollection Db
        {
            get { return _config.ConnectionStrings.ConnectionStrings; }
        }

        public KeyValueConfigurationCollection App
        {
            get { return _config.AppSettings.Settings; }
        }

        public Config()
        {
            Configuration roamingConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            var configFileMap = new ExeConfigurationFileMap
                                    {
                                        ExeConfigFilename = roamingConfig.FilePath
                                    };
            _config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
        }
    }
}
